Author: ChinSyun Pang
Weibo: arthinking_plus
Posted in: http://www.itzhai.com
1、数据库需要5.5.3+的支持
2、修改database、table和column字符集
1 | ALTER DATABASE guitargg CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; |
3、修改配置文件
etc/mysql/my.cnf1
2
3
4
5
6
7
8
9[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci init_connect='SET NAMES utf8mb4'
4、重启MySQL Server
1 | /etc/init.d/mysql restart |
5、升级JDBC驱动
确保mysql connector版本高于5.1.13
6、检查应用的数据库连接配置:
1 | jdbc.driverClassName=com.mysql.jdbc.Driver |